import Mock from 'mockjs'

const mocksContext = require.context("./modules", true, /.js$/);

mocksContext.keys().forEach(file_name => {
  // 获取文件中的 default 模块
  const mocks = mocksContext(file_name);
  for (const item of mocks) {
    Mock.mock(new RegExp(`${item.url}`), item.type || "get", item.result);
  }
});